// pages/me/me.js
Page({
  data: {
    avatar_url: 'https://tse3-mm.cn.bing.net/th/id/OIP-C.IImkEfCKnlGUCckk3z31OgAAAA?pid=ImgDet&w=400&h=400&rs=1',
    nickname: '匿名用户',
    showaboutus:false,
    showAboutUsPopup: false,
    showContactImage: false,
    showfeedback:false,
    showfukuanma:false,
  },

  onLoad(options) {
    this.getUserInfo();
  },

  onShow() {

  },

  onChooseavatar(e) {
    this.setData({
      avatar_url: e.detail.avatarUrl
    });
    this.saveUserInfo();
  },

  onChoosenickname(e) {
    this.setData({
      nickname: e.detail.value
    });
    this.saveUserInfo();
  },
  saveUserInfo() {
    wx.setStorageSync('userInfo', {
      avatar_url: this.data.avatar_url,
      nickname: this.data.nickname
    });
  },
  getUserInfo() {
    const userInfo = wx.getStorageSync('userInfo');
    if (userInfo) {
      this.setData({
        avatar_url: userInfo.avatar_url,
        nickname: userInfo.nickname
      });
    }
  },

  To_History:function() {
    wx.navigateTo({
      url: '/pages/history/history',
    })
  },

  To_Favorite_Songs:function() {
    wx.navigateTo({
      url: '/pages/favoriteSongs/favoriteSongs',
    })
  },




  showAboutUsPopup() {
    this.setData({ showAboutUsPopup: true });
  },
  hideAboutUsPopup() {
    this.setData({ showAboutUsPopup: false ,showContactImage:false,showfukuanma:false});
  },
  contactUs() {
    this.setData({showContactImage:true,showfukuanma:false,showfeedback:false})
  },
  sponsorUs() {
    this.setData({showfukuanma:true,showContactImage:false,showfeedback:false})
  },
  feedback(){
    this.setData({showfeedback:true,showContactImage:false,showfukuanma:false})
  },
  copyContent:function(event){
    const content="https://wj.qq.com/s2/14997021/290b/"
    
    wx.setClipboardData({
      data: content,
      success: function() {
        wx.showToast({
          title: '内容已复制',
          icon: 'success'
        });
      }
    });

  },
})